<?php

use Illuminate\Routing\Router;

Admin::registerAuthRoutes();

Route::group([
    'prefix'        => config('admin.route.prefix'),
    'namespace'     => config('admin.route.namespace'),
    'middleware'    => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', 'HomeController@index')->name('admin.home');
    
    $router->get('miniprograminfo/{id}/edit', 'MiniProgramInfoController@edit');
    $router->put('miniprograminfo/{id}', 'MiniProgramInfoController@update');
    $router->get('miniprograminfo/{order}', 'MiniProgramInfoController@show');
    $router->resource('miniprogrammodules',MiniProgramModuleSettingsController::class);

    $router->resource('users',UsersController::class);
    // 轮播图
    $router->get('banners', 'BannersController@index');
    $router->get('banners/create', 'BannersController@create');
    $router->get('banners/{id}/edit', 'BannersController@edit');
    $router->post('banners', 'BannersController@store');
    $router->put('banners/{id}', 'BannersController@update');
    $router->delete('banners/{id}', 'BannersController@destroy');
    // $router->resource('banners',BannersController::class);
    // 品牌图片
    $router->get('brands', 'BrandsController@index');
    $router->get('brands/create', 'BrandsController@create');
    $router->get('brands/{id}/edit', 'BrandsController@edit');
    $router->post('brands', 'BrandsController@store');
    $router->put('brands/{id}', 'BrandsController@update');
    $router->delete('brands/{id}', 'BrandsController@destroy');
    // $router->resource('brands',BrandsController::class);
    //产品类别
    // $router->get('categories', 'CategoriesController@index');
    // $router->get('categories/create', 'CategoriesController@create');
    // $router->get('categories/{id}/edit', 'CategoriesController@edit');
    // $router->post('categories', 'CategoriesController@store');
    // $router->put('categories/{id}', 'CategoriesController@update');
    // $router->delete('categories/{id}', 'CategoriesController@destroy');
    $router->resource('categories',CategoriesController::class);
    $router->get('api/categories', 'CategoriesController@apiIndex')->name('api.getcategories');

    $router->resource('products',ProductsController::class);
    $router->resource('colors',AttributeColorsController::class);
    $router->resource('sizes',AttributeSizesController::class);

    $router->get('orders', 'OrdersController@index')->name('admin.orders.index');
    $router->get('orders/{order}', 'OrdersController@show')->name('admin.orders.show');
    $router->post('orders/{order}/ship', 'OrdersController@ship')->name('admin.orders.ship');
    $router->post('orders/{order}/refund', 'OrdersController@handleRefund')->name('admin.orders.handle_refund');
});
